﻿using System;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using MSAP.Framework.Interfaces;
using MSAP.Framework;

namespace PLL.Notes
{
    public class CreateNotesServicePage_SA : ServiceActionCommand
    {
        public CreateNotesServicePage_SA(NotesModule module)
            : base("NOTES.NOTES_SA", "NOTES.CREATE_NOTE_SP", "Notes", "Affiche la page des notes",
                   null, null,
                   true, new BitmapImage(new Uri("/PLL.Notes;component/Resources/Notes.png", UriKind.Relative)),
                   module)
        {
            this.execute = parameter => CreateServicePage(parameter);
            this.canExecute = canParameter => CanCreateServicePage(canParameter);
        }

        private void CreateServicePage(object parameter)
        {
            Module.AddServicePage(new NotesServicePage(Module as NotesModule));
        }

        private bool CanCreateServicePage(object parameter)
        {
            return true;
        }
    }
}
